< previous page page_509 next page >

Page 509
z0529-01.gif
Figure 14.27
B-spline blending functions for the knot values 0, 0, 0, 1, 2, 3, 3, 3.
Figure 14.27 shows the blending functions for parameter u of a degree three surface where the control point arrays are dimensioned as (0 To 4, 0 To 4). From this picture, you can see several important properties of the blending functions. These properties are similar to those of the blending functions for two-dimensional B-spline curves.
First, for any value of u, the sum of the values of all of the functions on input u equals one. This makes the coordinates of the points on the surface a weighted average of the coordinates of some of the control points.
Second, each blending function is nonzero over only part of the domain of u values. The function N1,3(u), for instance, is nonzero where 0 < u < 2. Because the nonzero domain for each function is limited, the coordinates of the points on the surface that are affected by each function are also limited. If you change the position of a control point, the surface is affected only for values of u and v for which that control point's blending function is nonzero. This gives you local control over the shape of the surface.
The code for displaying B-spline surfaces is very similar to that for displaying Bezier surfaces. The largest difference is in the way you vary the parameters u and v. To draw a Bezier surface, you vary u and v between 0.0 and 1.0. To draw a degree k B-spline surface with control points stored in arrays dimensioned (0 To M, 0 To N), you need to vary u and v over the ranges 0 <= u <= M k +2 and 0 <= v <= N k + 2.
To convert the Bezier3d class into a BSpline3d class, you need to change the InitializeGrid subroutine so it uses these ranges for u and v.
e10a6a0a59f035e870d90cca05b85fce.gif
' Create polylines to represent the surface.
Public Sub InitializeGrid( _

 
< previous page page_509 next page >